package com.czkt.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.czkt.entity.SysRole;
import com.czkt.service.ISysRoleService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author jobob
 * @since 2024-06-18
 */
@Controller
public class SysRoleController {
    @Resource
    ISysRoleService roleService;

    @RequestMapping("/role/list")
    public String roleList(@RequestParam(value = "roleName",defaultValue = "") String roleName,@RequestParam(value = "pageIndex",defaultValue = "1") Integer pageIndex,
                           @RequestParam(defaultValue = "3") Integer pageSize, Model model){
        IPage<SysRole> roleIPage = roleService.roleList(roleName,pageIndex,pageSize);
        model.addAttribute("rolePage",roleIPage);
        model.addAttribute("roleName",roleName);
        return "/role/list";
    }
}
